/* * Copyright (C) 2021 Huawei Device Co., Ltd.
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.zhouyou.http.demo.view;

import com.zhouyou.http.demo.ResourceTable;
import com.zhouyou.http.subsciber.IProgressDialog;
import com.zhouyou.http.view.CancelableDialog;
import ohos.agp.components.Component;
import ohos.agp.components.LayoutScatter;
import ohos.agp.components.ProgressBar;
import ohos.agp.components.Text;
import ohos.app.Context;


public class ProgressDialog extends CancelableDialog {
    private ProgressBar mProgress;
    private String mMessage;
    private Text mMessageView;

    public ProgressDialog(Context context) {
        super(context);
    }


    public void setMessage(String message) {
        if (mProgress != null) {
            mMessageView.setText(message);
        } else {
            mMessage = message;
        }
    }

    @Override
    protected void onCreate() {
        super.onCreate();
//        setTitleText("加载中");
        Component component = LayoutScatter.getInstance(this.context).parse(ResourceTable.Layout_progress_dialog_custom_layout, null, true);
        mMessageView = (Text) component.findComponentById(ResourceTable.Id_text_message);

        setContentCustomComponent(component);


    }
}
